package io.gitee.twoke.generator.engine.impl.persistence.entity;

import io.gitee.twoke.generator.engine.impl.cfg.GenerateEngineConfigurationImpl;
import io.gitee.twoke.generator.engine.impl.persistence.TemplateFileDataManager;
import io.gitee.twoke.generator.engine.impl.persistence.entity.data.DataManager;
import io.gitee.twoke.generator.engine.impl.template.TemplateFile;
import io.gitee.twoke.generator.engine.impl.template.impl.TemplateFileQueryImpl;

import java.util.List;

public class TemplateFileEntityManagerImpl
        extends AbstractEntityManager<TemplateFileEntity> implements TemplateFileEntityManager{

    protected TemplateFileDataManager dataManager;

    public TemplateFileEntityManagerImpl(GenerateEngineConfigurationImpl generateEngineConfiguration,
                                     TemplateFileDataManager templateDataManager) {
        super(generateEngineConfiguration);
        this.dataManager = templateDataManager;
    }

    @Override
    public DataManager<TemplateFileEntity> getDataManager() {
        return dataManager;
    }

    @Override
    public long findTemplateFileCountByQueryCriteria(TemplateFileQueryImpl templateFileQuery) {
        return dataManager.findTemplateFileCountByQueryCriteria(templateFileQuery);
    }

    @Override
    public List<TemplateFile> findTemplateFilesByQueryCriteria(TemplateFileQueryImpl templateFileQuery) {
        return dataManager.findTemplateFilesByQueryCriteria(templateFileQuery);
    }

    @Override
    public void deleteTemplateFilesByTemplateId(String templateId) {
        this.dataManager.deleteTemplateFilesByTemplateId(templateId);
    }
}
